import service from '@/utils/request'

/**
 *
 * 获取组织架构数据
 *
*/
export const getDepartments = () => {
  return service({
    url: '/company/department'
  })
}
export const getManagerList = () => {
  return service({
    url: '/sys/user/simple'
  })
}
/**
   * 用于增加子部门
   * @param {*} data 5个
   * @returns 返回这次请求
   */
export const addDepartments = data =>
  service({
    url: '/company/department',
    method: 'post',
    data
  })
  /**
   * 获取部门详情
   */
export const getDepartDetail = id =>
  service({
    url: `/company/department/${id}`
  })
/**
 * 编辑部门
 * @param {*} data 编辑部门需要7个字段  id,pid,name,code,managerId,
introduce,createTime
 * @returns 返回请求
 */
export const editDepartment = (data) =>
  service({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })

// 大型公司  专门负责根据接口文档写api接口封装 => 拧螺丝

export const deleteDepartment = (id) =>
  service({
    url: `/company/department/${id}`,
    method: 'delete'
  })

// 增删改查业务 => 1 + 1 + 1 + 2(回显) = 5
